# -*- coding: UTF-8 -*-

from __future__ import unicode_literals

from django.db import models

# Create your models here.

class mBook(models.Model):
	name = models.CharField(max_length=30,null=False)
	author = models.CharField(max_length=30,null=False)
	isbn = models.CharField(max_length=30,null=False)
	image = models.ImageField(null=False)
	available = models.BooleanField(default=False)
	timestamp = models.DateTimeField(auto_now_add=True)
	def __unicode__(self):
		return self.name
	class Meta:
		verbose_name = '推荐书'
		verbose_name_plural = '推荐书'

class mComment(models.Model):
	book = models.ForeignKey(mBook, null=False)
	comment = models.TextField(null=False)
	# reader_id
	reader_name = models.CharField(max_length=30,null=False)
	available = models.BooleanField(default=False)
	timestamp = models.DateTimeField(auto_now_add=True)
	def __unicode__(self):
		return self.comment
	class Meta:
		verbose_name = '推荐语'
		verbose_name_plural = '推荐语'
